package org.ipms.e.auth.api.controller.base;

import org.ipms.c.common.persistence.web.ResponseCode;
import org.ipms.c.common.persistence.web.ResponseData;
import org.ipms.c.common.persistence.web.ResponseResult;
import org.ipms.e.auth.api.controller.BaseController;
import org.ipms.e.auth.core.base.entity.Area;
import org.ipms.e.auth.core.base.qo.AreaQO;
import org.ipms.e.auth.core.base.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/area")
public class AreaController extends BaseController{
	
	@Autowired
	AreaService areaService;
	
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ResponseData addUser(@RequestBody Area area) {
        try{
        	areaService.insert(area);
        	Area area_ = areaService.queryUnique(new AreaQO());
            return ResponseResult.success(area_);
        }catch (Exception e) {
        	e.printStackTrace();
            return ResponseResult.error(ResponseCode.FAIL.code);
        }
    }
	
    
    
}
